﻿using System.Windows;
using System.ComponentModel;
namespace FontResize2
{
    public partial class App : INotifyPropertyChanged
    {
        public App()
        {
            Factor = 0;
            FontSizeSmall = 10;
            FontSizeMedium = 20;
            FontSizeLarge = 30;
        }

        private int factor;
        public int Factor
        {
            get { return factor; }
            set
            {
                factor = value;
                RaisePropertyChanged("Factor");
                RaisePropertyChanged("FontSizeSmall");
                RaisePropertyChanged("FontSizeMedium");
                RaisePropertyChanged("FontSizeLarge");
            }
        }

        private int fontSizeSmall;
        public int FontSizeSmall
        {
            get { return fontSizeSmall + (fontSizeSmall * Factor / 10); }
            set
            {
                fontSizeSmall = value;
                RaisePropertyChanged("FontSizeSmall");
            }
        }

        private int fontSizeMedium;
        public int FontSizeMedium
        {
            get { return fontSizeMedium + (fontSizeMedium * Factor / 10); }
            set
            {
                fontSizeMedium = value;
                RaisePropertyChanged("FontSizeMedium");
            }
        }

        private int fontSizeLarge;
        public int FontSizeLarge
        {
            get { return fontSizeLarge + (fontSizeLarge * Factor / 10); }
            set
            {
                fontSizeLarge = value;
                RaisePropertyChanged("FontSizeLarge");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
